package org.example;

public class BooklShelfIterator implements Interator{
    private BookShelf bookShelf;
    private int index;
    public BooklShelfIterator(BookShelf bookShelf) {
        this.bookShelf=bookShelf;
        index=0;
    }

    @Override
    public Boolean hasnext() {
        if (index<bookShelf.getLenght()){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public Object next() {
        Book bootAt = bookShelf.getBootAt(index);
        index++;
        return bootAt;
    }
}
